import java.io.*;
import java.util.*;
public class 小红的口罩{
    /*
    https://ac.nowcoder.com/acm/problem/229953
     */
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    public static void main(String[] args) throws IOException{
        int n = in.nextInt();
        int k = in.nextInt();
        PriorityQueue<Long> heap = new PriorityQueue<>();
        //堆来实现
        for(int i = 0;i < n;i++){
            heap.add(in.nextLong());
        }
        long sum = 0;
        int ret = 0;
        while(true){
            long cur = heap.poll();
            sum += cur;
            //不舒服就退出
            if(sum > k){
                break;
            }
            //否则 * 2 用long防止溢出
            heap.offer(cur*2);
            ret++;
        }
        out.println(ret);
        out.close();
    }
}

class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }

    String nextLine() throws IOException{
        return bf.readLine();
    }

    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
}